Defines a type capable of encapsulating a system of nonlinear equations of the form: F(X) = 0. This type is used to establish the system of equations to solve, and provides a means for computing the Jacobian matrix for the system of equations, and any other ancillary operations that may be needed by the solver.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real64), | public, | allocatable, dimension(:) | :: | m_fwork |
A function evaluation workspace array. |
||
| real(kind=real64), | public, | allocatable, dimension(:,:) | :: | m_jwork |
An FD workspace for the Jacobian calculations with one column available per thread. |
||
| real(kind=real64), | public, | allocatable, dimension(:,:) | :: | m_xjwork |
An FD workspace for the Jacobian calculations with one column available per thread. |
Executes the routine containing the system of equations to solve. No action is taken if the pointer to the subroutine has not been defined.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vecfcn_helper), | intent(inout) | :: | this |
The vecfcn_helper object. |
||
| real(kind=real64), | intent(in), | dimension(:) | :: | x |
An N-element array containing the independent variables. |
|
| real(kind=real64), | intent(out), | dimension(:) | :: | f |
An M-element array that, on output, contains the values of the M functions. |
|
| class(*), | intent(in), | optional | :: | args |
An optional argument to allow the user to communicate with the routine. |
Gets the number of equations in this system.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vecfcn_helper), | intent(in) | :: | this |
The vecfcn_helper object. |
The function count.
Gets the maximum number of threads to use when evaluating the Jacobian matrix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vecfcn_helper), | intent(in) | :: | this |
The vecfcn_helper object. |
The number of threads allowed.
Gets the number of variables in this system.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vecfcn_helper), | intent(in) | :: | this |
The vecfcn_helper object. |
The number of variables.
Tests if the pointer to the subroutine containing the system of equations to solve has been assigned.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vecfcn_helper), | intent(in) | :: | this |
The vecfcn_helper object. |
Returns true if the pointer has been assigned; else, false.
Tests if the pointer to the Jacobian calculation routine has been defined.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vecfcn_helper), | intent(in) | :: | this |
The vecfcn_helper object. |
Returns true if the pointer has been assigned; else, false.
Executes the routine containing the Jacobian matrix if supplied. Otherwise, uses AD when an AD-compatible function is registered, falling back to finite differences.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vecfcn_helper), | intent(inout) | :: | this |
The vecfcn_helper object. |
||
| real(kind=real64), | intent(inout), | dimension(:) | :: | x |
An N-element array containing the independent variables defining the point about which the derivatives will be calculated. |
|
| real(kind=real64), | intent(out), | dimension(:,:) | :: | jac |
An M-by-N matrix where, on output, the Jacobian will be written. |
|
| real(kind=real64), | intent(in), | optional, | dimension(:), target | :: | fv |
An optional M-element array containing the function values at x. If not supplied, the function values are computed at x. |
| class(*), | intent(in), | optional | :: | args |
An optional argument to allow the user to communicate with the routine. |
Establishes a pointer to the AD-compatible routine containing the function. If utilized, this will allow for computation of the gradient, for applicable solvers, via AD. However, a user-defined gradient does take precedence over an AD generated gradient.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vecfcn_helper), | intent(inout) | :: | this |
The vecfcn_helper object. |
||
| procedure(vector_function), | intent(in), | pointer | :: | fcn |
The function pointer. |
|
| integer, | intent(in) | :: | nfcn |
The number of functions. |
||
| integer, | intent(in) | :: | nvar |
The number of variables. |
Establishes a pointer to the routine containing the system of equations to solve.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vecfcn_helper), | intent(inout) | :: | this |
The vecfcn_helper object. |
||
| procedure(vecfcn), | intent(in), | pointer | :: | fcn |
The function pointer. |
|
| integer, | intent(in) | :: | nfcn |
The number of functions. |
||
| integer, | intent(in) | :: | nvar |
The number of variables. |
Establishes a pointer to the routine for computing the Jacobian matrix of the system of equations. If no routine is defined, the Jacobian matrix will be computed numerically (this is the default state).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vecfcn_helper), | intent(inout) | :: | this |
The vecfcn_helper object. |
||
| procedure(jacobianfcn), | intent(in), | pointer | :: | jac |
The function pointer. |
Sets the maximum number of threads to use when evaluating the Jacobian matrix. With multiple threads, function callbacks must be thread-safe. Do not evaluate the same helper concurrently from separate callers.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(vecfcn_helper), | intent(inout) | :: | this |
The vecfcn_helper object. |
||
| integer, | intent(in) | :: | n |
The maximum allowed number of threads. |